//
//  UITextFieldViewController.swift
//  testRxSwift
//
//  Created by 火星人 on 2017/7/26.
//  Copyright © 2017年 火星人. All rights reserved.
//

import UIKit
import RxCocoa
import RxSwift

class UITextFieldViewController: BaseViewController {

    var textField: UITextField!
    let bag = DisposeBag()
    
    override func viewDidLoad() {
        super.viewDidLoad()

        
        textField = UITextField(frame: CGRect(x: 0, y: 80, width: self.view.width, height: 30))
        textField.backgroundColor = UIColor.lightGray.withAlphaComponent(0.2)
        
        self.view.addSubview(textField)
        
        textField.rx.text.orEmpty.asObservable()
            .filter{
                return $0 != ""
            }
            .subscribe({ (eve) in
                print(eve)
            })
            .disposed(by: bag)
    }
      
}
